package com.kgc.lab3;

public class TestClass {
    public static void main(String[] args) {
        //1、equals()相等，hashCode一定相同
        String str1 = new String("abc");
        String str2 = new String("abc");
        System.out.println(str1.equals(str2));
        System.out.println(str1.hashCode());
        System.out.println(str2.hashCode());

        // 2、hashCode相同，equals()不一定相等
        Character ch = 'a';
        Integer num = 97;
        System.out.println(ch.equals(num));
        System.out.println(ch.hashCode());
        System.out.println(num.hashCode());


    }
}
